<extend name="./Apps/Home/View/default/shops/layout.html" />
<block name="content">

<script src="__PUBLIC__/plugins/kindeditor/kindeditor.js"></script>
<script src="__PUBLIC__/plugins/kindeditor/lang/zh-CN.js"></script>

<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugins/webuploader/style.css" />
<style>


</style>   
<script>

$(function () {
	$.formValidator.initConfig({
		theme:'Default',mode:'AutoTip',formID:"myform",debug:true,submitOnce:true,onSuccess:function(){
			eidtCoupon('{$umark}');
			return false;
		},onError:function(msg){
	}});
	$("#couponName").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({min:1,max:200,onError:"请输入优惠活动名称"});
	$("#couponMoney").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({min:1,onError:"请输入优惠券面额"});
	$("#spendMoney").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({min:1,onError:"请输入最低消费金额"});
	$("#sendNum").formValidator({tipID:"sendNum_tip",onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({min:0,onError:"请输入发放数量"});
	$("#sendStartTime").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({onError: "请输入发放开始时间"});
	$("#sendEndTime").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({onError: "请输入发放结束时间"});
	$("#validStartTime").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({onError: "请输入活动开始时间"});
	$("#validEndTime").formValidator({onShow:"",onFocus:"",onCorrect:"输入正确"}).inputValidator({onError: "请输入活动结束时间"});
	   
	KindEditor.ready(function(K) {
		editor1 = K.create('textarea[name="couponDes"]', {
			height:'250px',
			width:"800px",
			allowFileManager : false,
			allowImageUpload : true,
			items:[
				'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste',
				'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
				'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
				'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
				'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
				'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|','image','multiimage','table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
				'anchor', 'link', 'unlink', '|', 'about'
			],
			afterBlur: function(){ this.sync(); }
		});
	});
});

</script>
       <div class="wst-body"> 
       <div class='wst-page-header'>卖家中心 > <if condition="$object['goodsId'] ==0 ">新增<else/>编辑</if>优惠券资料</div>
       <div class='wst-page-content'>
       <div id='tab' class="wst-tab-box">
		
    	<div class="wst-tab-content" style='width:99%;margin-bottom: 10px;'>
    	<div class='wst-tab-item' style="position: relative;style='display:none'">
	       <form name="myform" method="post" id="myform" autocomplete="off">
	        <input type='hidden' id='id' class='wstipt' value='{$object.couponId}'/>
	        <table class="wst-form" >
	           <tr>
	             <th width='120'>优惠活动名称<font color='red'>*</font>：</th>
	             <td><input type='text' id='couponName' name='couponName' class="wst-ipt wstipt" value='{$object.couponName}' maxLength='100'/></td>
	           </tr>
	            <tr>
	             <th width='120'>优惠券面额<font color='red'>*</font>：</th>
	             <td>
	             	<input type='text' id='couponMoney' name='couponMoney' class="wstipt wst-ipt" value='{$object.couponMoney}' onkeypress="return WST.isNumberdoteKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='10'/>
	             </td>
	           </tr>
	            <tr>
	             <th width='120'>最低消费金额<font color='red'>*</font>：</th>
	             <td>
	             	<input type='text' id='spendMoney' name='spendMoney' class="wstipt wst-ipt" value='{$object.spendMoney}' onkeypress="return WST.isNumberdoteKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='10'/>
	             </td>
	           </tr>
	           <tr>
	             <th width='120'>发放数量<font color='red'>*</font>：</th>
	             <td><input type='text' id='sendNum' name='sendNum' class="wstipt wst-ipt" value='{$object.sendNum}'  maxLength='25'/><span class="wst-tips">注：为 0 时表示不限制数量</span><span id="sendNum_tip"></span></td>
	           </tr>
	           <tr>
	             <th width='120'>发放开始时间<font color='red'>*</font>：</th>
	             <td>
	             <input type='text' id='sendStartTime' class='wstipt laydate-icon' name='sendStartTime'value='{$object.sendStartTime}' style='width:168px;line-height:16px;height:auto;' placeholder='开始日期'/>
	             </td>
	           </tr>
	           <tr>
	             <th width='120'>发放结束时间<font color='red'>*</font>：</th>
	             <td>
	             <input type='text' id='sendEndTime' class='wstipt laydate-icon' name='sendEndTime'value='{$object.sendEndTime}' style='width:168px;line-height:16px;height:auto;' placeholder='结束日期'/>
	             </td>
	           </tr>
	           <tr>
	             <th width='120'>活动开始时间<font color='red'>*</font>：</th>
	             <td>
	             <input type='text' id='validStartTime' class='wstipt laydate-icon' name='validStartTime'value='{$object.validStartTime}' style='width:168px;line-height:16px;height:auto;' placeholder='开始日期'/>
	             </td>
	           </tr>
	           <tr>
	             <th width='120'>活动结束时间<font color='red'>*</font>：</th>
	             <td>
	             <input type='text' id='validEndTime' class='wstipt laydate-icon' name='validEndTime'value='{$object.validEndTime}' style='width:168px;line-height:16px;height:auto;' placeholder='结束日期'/>
	             </td>
	           </tr>
	          
	           <tr>
	             <th width='120'>优惠活动描述：</th>
	             <td>
	             <textarea rows="2" cols="60" id='couponDes' class='wstipt' name='couponDes'>{$object.couponDes}</textarea>
	             </td>
	           </tr>
	           <tr>
	             <td colspan='2' style='padding-left:320px;'>
	                 <button class='wst-btn-query' type="submit">保&nbsp;存</button>
	                 <button class='wst-btn-query' type="button" onclick='javascript:location.href="{:U('Home/Coupons/queryCouponByPage')}"'>返&nbsp;回</button>
	             </td>
	           </tr>
	        </table>
	        </form>
	      </div>
	    </div>
	    </div>
       </div>
       <div style='clear:both;'></div>
       </div>
</block>
<block name="js">
<script >
	var sendStartTime = {
		elem: '#sendStartTime',
	  	format: 'YYYY/MM/DD',
		min: laydate.now(),
	  	istime: true,
	  	istoday: false,
	  	choose: function(datas){
	  		sendEndTime.min = datas; //开始日选好后，重置结束日的最小日期
	  		sendEndTime.start = datas //将结束日的初始值设定为开始日
	  	}
	};
	var sendEndTime = {
	  	elem: '#sendEndTime',
	  	format: 'YYYY/MM/DD',
	  	min: laydate.now(),
	  	istime: true,
	  	istoday: false,
	  	choose: function(datas){
	  		sendStartTime.max = datas; //结束日选好后，重置开始日的最大日期
	  	}
	};
	
	var validStartTime = {
			elem: '#validStartTime',
		  	format: 'YYYY/MM/DD',
			min: laydate.now(),
		  	istime: true,
		  	istoday: false,
		  	choose: function(datas){
		  		validEndTime.min = datas; //开始日选好后，重置结束日的最小日期
		  		validEndTime.start = datas //将结束日的初始值设定为开始日
		  	}
		};
		var validEndTime = {
		  	elem: '#validEndTime',
		  	format: 'YYYY/MM/DD',
		  	min: laydate.now(),
		  	istime: true,
		  	istoday: false,
		  	choose: function(datas){
		  		validStartTime.max = datas; //结束日选好后，重置开始日的最大日期
		  	}
		};
	laydate(sendStartTime);
	laydate(sendEndTime);
	laydate(validStartTime);
	laydate(validEndTime);
</script>
<script src="__ROOT__/Apps/Home/View/{$WST_STYLE}/js/shops/coupons.js"></script>
</block>